/**
 * 2
 *  
 * @Author : roryrywang
 * @DateTime : 24-8-25 下午2:39
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int check(long long x) {
    int res = 0;
    while (x >= 2) {
        if (x % 2) return res;
        x /= 2;
        res++;
    }
    return res;
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;

        int aNum = 0;
        int bNum = 0;
        vector<long long> nums(n);
        for (int i = 0; i < n; ++i) {
            cin >> nums[i];
            if (nums[i] % 2) aNum++;
            else bNum++;
        }
        if (aNum != 0) {
            cout << bNum << endl;
            continue;
        }
        int minCount = 0x3f3f3f3f;
        for (int i = 0; i < n; ++i) {
            minCount = min(minCount, check(nums[i]));
        }
        cout << minCount + bNum - 1 << endl;
    }
    return 0;
}